package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.module.base.common.vo.operationPeriod.OperationCurVO;
import com.bifang.module.base.common.vo.operationPeriod.OperationPeriodQueryVO;
import com.bifang.module.base.common.vo.operationPeriod.OperationPeriodVO;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.cache.EduOperationCacheDetailVO;
import com.jwsoft.manager.common.vo.cache.EduOperationCacheQueryVO;
import com.jwsoft.manager.common.vo.cache.EduOperationCacheVO;
import com.jwsoft.manager.core.integration.EduSystemConfigIntegration;
import com.jwsoft.manager.core.integration.OperationCacheIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @since 2022-12-28
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "教育时间控制参数", description = "教育时间控制参数")
public class OperationCacheController {

    @Autowired
    public OperationCacheIntegration operationCacheIntegration;
    @Autowired
    private EduSystemConfigIntegration eduSystemConfigIntegration;

    @Operation(summary = "获取招生时间控制参数",description = "获取招生时间控制参数")
    @PostMapping(value = "/OperationCache0001", produces = "application/json;charset=UTF-8")
    public AppResponse<EduOperationCacheVO> getList(@RequestBody @Validated EduOperationCacheQueryVO vo) {
        return AppResponse.successData(eduSystemConfigIntegration.getEduOperation(vo));
    }

    @Operation(summary = "获取招生参缓存清除",description = "获取招生参缓存清除")
    @PostMapping(value = "/OperationCache0002", produces = "application/json;charset=UTF-8")
    public AppResponse clearCache(@RequestBody @Validated EduOperationCacheQueryVO vo) {

        operationCacheIntegration.clearCache(vo);
        return AppResponse.successMsg("清除成功");
    }
    @Operation(summary = "根据业务期类型获取单个招生时间控制参数",description = "根据业务期类型获取单个招生时间控制参数")
    @PostMapping(value = "/OperationCache0003", produces = "application/json;charset=UTF-8")
    public AppResponse<EduOperationCacheDetailVO> getOne(@RequestBody @Validated EduOperationCacheQueryVO vo) {
        return AppResponse.successData(eduSystemConfigIntegration.getEduOperationOne(vo));
    }

    @Operation(summary = "教育相关业务期单个校验",description = "教育相关业务期单个校验")
    @PostMapping(value = "/OperationCache0004", produces = "application/json;charset=UTF-8")
    public AppResponse checkOperation(@RequestBody @Validated EduOperationCacheQueryVO vo) {
        eduSystemConfigIntegration.checkOperation(vo);
        return AppResponse.success();
    }

    @Operation(summary = "获取招生年度参数",description = "获取招生年度参数")
    @PostMapping(value = "/OperationCache0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduOperationCacheDetailVO> getPeriodYear(@RequestBody OperationCurVO vo) {
        return AppResponse.successData(operationCacheIntegration.getPeriodYear(vo));
    }

    @Operation(summary = "教育业务期管理根据分类分页查询",description = "教育业务期管理根据分类分页查询")
    @PostMapping(value = "/OperationCache0007", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<OperationPeriodVO>> getOperationListByClassify(@RequestBody @Validated OperationPeriodQueryVO vo) {
        return AppResponse.successData(operationCacheIntegration.getOperationListByClassify(vo));
    }




}
